unit Project;

interface

uses
  OmniXML;

type
  TProject = class
    private
      schemaPath: String;
      schemaXML: IXMLDocument;
    public
      function load(path: String): boolean;
      function parseSchema(): Boolean;
      procedure setSchemaPath(val: String);
      function getSchemaPath(): String;
      procedure loadSchemaFile();
      function getSchemaFile(): IXMLDocument;
  end;

implementation

uses
  SysUtils;

{ TProject }

function TProject.getSchemaFile: IXMLDocument;
begin
  if (schemaXML = nil) then
    loadSchemaFile();
  Result := schemaXML;
end;

function TProject.getSchemaPath: String;
begin
  Result := schemaPath;
end;

function TProject.load(path: String): boolean;
begin
  setSchemaPath(path);
  if (parseSchema())
    then Result := true
    else Result := false;
end;

procedure TProject.loadSchemaFile;
begin
  if (getSchemaPath() <> '') then
  begin
    schemaXML := CreateXMLDoc;
    schemaXML.Load(getSchemaPath());
  end else begin
    raise Exception.Create('No schema file found');
  end;
end;

function TProject.parseSchema: Boolean;
begin
  Result := true;
end;

procedure TProject.setSchemaPath(val: String);
begin
  schemaPath := val;
end;

end.
